<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('主菜单')" />
</head>

<body>
<button type="button" class="btn btn-primary btn-lg" th:onclick="apply()" >申请卓越班</button>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    function apply(){
        var user =[[${user.userId}]];
        $.modal.confirm("确认要申请卓越班吗？（不可取消）", function() {
            $.ajax({
                type: "post",
                url: "/system/apply",
                data: {
                    userId: user
                },
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍后...");
                },
                success: function (result) {
                    if (result.msg === "操作失败") {
                        $.modal.msgWarning("对不起，你的成绩不合格，不能申请！");
                    }
                    else{
                        window.location.reload();
                    }

                    $.modal.closeLoading();
                }
            });
        });

    }
</script>
</body>
</html>
